from appium.webdriver.common.appiumby import AppiumBy

from app.page_object.base_page import BasePage


class AddBranchPage(BasePage):
    #点击添加子部门和输入部门的信息
    __BTN_BRANCH = (AppiumBy.XPATH, "//*[@text='添加子部门']")
    __IPT_BRANCH_NAME = (AppiumBy.XPATH, "//*[@text='请输入部门名称']")
    __BTN_DEFIND = (AppiumBy.XPATH, "//*[@text='确定']")
    def go_to_add_branch(self,branch_name):
        self.do_find(self.__BTN_BRANCH).click()
        self.do_send_keys(branch_name, self.__IPT_BRANCH_NAME)
        self.do_find(self.__BTN_DEFIND).click()
        # self.driver.find_element(AppiumBy.XPATH, "//*[@text='添加子部门']").click()
        # self.driver.find_element(AppiumBy.XPATH, "//*[@text='请输入部门名称']").send_keys(branch_name)
        # self.driver.find_element(AppiumBy.XPATH, "//*[@text='确定']").click()
        from app.page_object.member_list_page import MemberListPage
        return MemberListPage(self.driver)